/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.daoImpl;

import br.com.deployment.dao.GroupsDAO;
import br.com.deployment.entities.Executor;
import br.com.deployment.entities.Groups;
import br.com.deployment.entities.Questionnaire;
import br.com.deployment.genericdao.GenericDAO;
import java.util.List;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.Query;

/**
 *
 * @author ely
 */
@Stateless
@LocalBean
public class GroupsDAOImpl extends GenericDAO<Groups> implements GroupsDAO{
     
        public GroupsDAOImpl(){
            super(Groups.class);
        }

    @Override
    public List<Groups> findGoupsExecutor(Executor e) {
        String sql = "SELECT g FROM Executor e JOIN e.groups g WHERE "
                   + " e.id = :id";
        Query query = getEntityManager().createQuery(sql);
        query.setParameter("id", e.getId());
        return (List<Groups>) query.getResultList();
    }
}
